package com.constant;

import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.Enumeration;
import java.util.ResourceBundle;

/***************************************************************
 * Name:        RiskConstant.java     
 * Create At:   2018-07-06
 * Module:      业务系统常量配置
 * Description: [风控常量配置,系统常量统一定义到此文件，由专人统一维护]
 * Author       shanzhitong
 * ------------------------------------------------------------
 * 修改历史
 * 序号  日期  修改人   修改原因
 * 1
 * 2
***************************************************************/
public class RiskConstant {
	/*
	 * 增信通访问URL
	 */
	public static String ZXT_URL = "";
	/*
	 * 增信通访问USERNAME
	 */
	public static String ZXT_USERNAME = "";
	/*
	 * 增信通访问PASSWORD
	 */
	public static String ZXT_PASSWORD = "";
	/*
	 * 冰鉴登录接口URL、登录账户和密码
	 */
	public static String BJ_URL = "";
	public static String BJ_USERNAME = "";
	public static String BJ_PASSWORD = "";
	/*
	 * 冰鉴评分接口URL、服务名称
	 */
	public static String BJ_SCOREURL = "";
	public static String BJ_SERVICE = "";
	/*
	 * 公信宝授权接口url
	 */
	public static String GXB_URL = "";
	/*
	 * 公信宝授权接口相关参数
	 */
	public static String GXB_APPID = "";
	public static String GXB_APPSECRET = "";
	public static String GXB_DS_AUTHITEM = "";
	public static String GXB_JD_AUTHITEM = "";
	/*
	 * 获取淘宝授权初始化配置url
	 */
	public static String GXB_INIT_TAOBAOURL = "";
	/*
	 * 获取支付宝授权初始化配置url
	 */
	public static String GXB_INIT_ALIPAYURL = "";
	/*
	 * 刷新电商登录授权二维码url
	 */
	public static String GXB_REFRESH_QRURL = "";
	/*
	 * 刷新电商登录的图片验证码url
	 */
	public static String GXB_REFRESH_VERIFYURL = "";
	/*
	 * 账号密码登录提交url
	 */
	public static String GXB_LOGINURL = "";
	/*
	 * 二次验证码提交url
	 */
	public static String GXB_CODEURL = "";
	/*
	 * 获取电商任务的当前状态url
	 */
	public static String GXB_STATUSURL = "";
	/*
	 * 刷新电商的短信验证码url
	 */
	public static String GXB_REFRESH_SMSURL = "";
	
	
	
    //初始化系统常量
	static {
		try {
			ResourceBundle rb = ResourceBundle.getBundle("risk");
			Class classs = RiskConstant.class;
			Field[] fields = classs.getFields();
			for (Field field : fields) {
				Type type = field.getGenericType();
				String fieldName = field.getName();
				Enumeration<String> enu = rb.getKeys();
				while (enu.hasMoreElements()) {
					String proName = enu.nextElement();
					if (fieldName.equals(proName)) {
						String fieldValue = rb.getString(fieldName);
						if ("boolean".equals(type.toString())) {
							field.setBoolean(classs, Boolean.parseBoolean(fieldValue));
						} else if ("class java.lang.String".equals(type.toString())) {
							field.set(classs, fieldValue);
						}
					}
				}
			}
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}
	}
}
